<tagLib name="html" />

<include file="Public:header" />

<div class="container" id="cpcontainer">
    <div class="itemtitle">
        <h3>{$Think.lang.email.title}</h3>
        <ul class="tab1" id="submenu">
            <li><a href="__URL__/email"><span>{$Think.lang.email.config}</span></a></li>
            <li class="current"><a href="__URL__/emailTemplate"><span>{$Think.lang.email.tpl}</span></a></li>
        </ul>
    </div>
    <p class="tips">{$Think.lang.email.tpl_tips}</p>
    <form id="cpform" name="cpform" method="post" action="__URL__/emailTemplate">
    <input type="hidden" name="op" value="save" />
    <table class="tb tb2">
        <tr class="nobg"><td colspan="2" class="td27">{$Think.lang.email.lang}:</td></tr>
        <tr>
            <td class="vtop rowform" colspan="2"><html:select id="language" name="language" options="langOptions" selected="langSelected" onchange="changeTemplate();" />
            </td>
            <td class="vtop tips2"></td>
        </tr>
        <tr class="nobg"><td colspan="2" class="td27">{$Think.lang.email.tpl}:</td></tr>
        <tr>
            <td class="vtop rowform">
                <select id="identifier" name="identifier" onchange="changeTemplate();">
                <volist name="templateList" id="vo">
                    <option value="{$vo.identifier}" <if condition="$vo.identifier eq $rs['identifier']">selected</if>>{$vo.identifier}</option>
                </volist>
                </select>
            </td>
            <td class="vtop tips2"></td>
        </tr>
        <tr class="nobg"><td colspan="2" class="td27">{$Think.lang.email.subject}:</td></tr>
        <tr>
            <td class="vtop rowform"><input id="subject" class="txt400" name="subject" value="{$rs.subject}" /></td>
            <td class="vtop tips2"></td>
        </tr>
        <tr class="nobg"><td colspan="2" class="td27">{$Think.lang.email.msg}:</td></tr>
        <tr>
            <td colspan="2"><html:markitup mode="bbcode" id="message" name="message" content="{$rs.message}" /></td>
        </tr>
        <tr class="nobg"><td colspan="15"><div class="fixsel"><input id="save" class="btn" type="submit" value="{$Think.lang.submit}" /></div></td></tr>
    </table>
    </form>
</div>

<script type="text/javascript">
function changeTemplate(){
    var language = $('#language').val();
    var identifier = $('#identifier').val();
    var url = '__URL__/emailTemplate/language/'+ language +'/identifier/'+ identifier;
    window.location.href = url;
}
</script>

<include file="Public:footer" />
